package com.common.www.bean.entity.sale;

import com.common.www.MyApplicationListener;
import org.springframework.boot.base.jpa.domain.entity.NumberIdentityEntity;
import com.fasterxml.jackson.annotation.JsonIgnoreProperties;

import org.hibernate.annotations.Cache;
import org.hibernate.annotations.CacheConcurrencyStrategy;
import org.hibernate.annotations.DynamicInsert;
import org.hibernate.annotations.DynamicUpdate;

import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.JoinColumn;
import javax.persistence.ManyToOne;
import javax.persistence.Table;

import lombok.AllArgsConstructor;
import lombok.Getter;
import lombok.NoArgsConstructor;
import lombok.Setter;

/**
 * 回收单对应的上传的个类型图片
 */
@DynamicUpdate(false)
@DynamicInsert(false)
@Getter
@Setter
@Entity
@Cache(usage = CacheConcurrencyStrategy.READ_WRITE)
@NoArgsConstructor
@AllArgsConstructor
@Table()
@JsonIgnoreProperties(value = {})
public class SaleBillImgItem extends NumberIdentityEntity {

    private static final long serialVersionUID = -2278084748058910042L;

    @JsonIgnoreProperties(value = {"typeList"})
    @ManyToOne()
    @JoinColumn(name = "parent")
    private SaleBill bill;


    /**
     * 类型名称名称
     */
    @Column(length = 128)
    private String name;

    /**
     * 1.转账图片 2.现场回收图片
     */
    @Column(length = 128)
    private Integer type;

    public String getDownloadUrl() {
        return MyApplicationListener.projectPath + name;
    }

}
